#include <iostream>

using namespace std;
int main(){
    int n;
    cin >> n;
    int table[40][40] = {99};
     for(int i=0;i<n;i++){
    	for(int j=0;j<n;j++){
        	table[i][j]=-1;
        }
    }
    table[0][(n-1)/2]=1;
    int tmpx=(n-1)/2,tmpy=0;
    for(int i=1;i<n*n;i++){
    	if(tmpy==0 && tmpx!=n-1){
            tmpx = tmpx+1;
            tmpy = n-1;
        } else if (tmpx==n-1 && tmpy!=0){
            tmpx = 0;
            tmpy = tmpy-1;
        } else if (tmpx==n-1 && tmpy==0){
            tmpy = tmpy+1;
        } else if (tmpx!=n-1 && tmpy!=0){
            if(table[tmpy-1][tmpx+1]==-1){
                tmpy=tmpy-1;
                tmpx=tmpx+1;
            } else {
                tmpy=tmpy+1;
            }
        }
        table[tmpy][tmpx] = i+1;
    }
    for(int i=0;i<n;i++){
    	for(int j=0;j<n;j++){
        	cout << table[i][j] << " ";
        }
        cout << endl;
    }
}
